import { UseToastOptions } from '@chakra-ui/react';
import { InvokeLogLevel } from 'logging/logger';
import { ProgressImage } from 'services/events/types';

export type SystemStatus =
  | 'CONNECTED'
  | 'DISCONNECTED'
  | 'PROCESSING'
  | 'ERROR'
  | 'LOADING_MODEL';

export type DenoiseProgress = {
  session_id: string;
  batch_id: string;
  progress_image: ProgressImage | null | undefined;
  step: number;
  total_steps: number;
  order: number;
  percentage: number;
};

export interface SystemState {
  isInitialized: boolean;
  isConnected: boolean;
  toastQueue: UseToastOptions[];
  denoiseProgress: DenoiseProgress | null;
  shouldAntialiasProgressImage: boolean;
  consoleLogLevel: InvokeLogLevel;
  shouldLogToConsole: boolean;
  status: SystemStatus;
}

export const STATUS_TRANSLATION_KEYS: Record<SystemStatus, string> = {
  CONNECTED: 'common.statusConnected',
  DISCONNECTED: 'common.statusDisconnected',
  PROCESSING: 'common.statusProcessing',
  ERROR: 'common.statusError',
  LOADING_MODEL: 'common.statusLoadingModel',
};
